Program a Concurrent Traffic Simulation
FP.1 Create a TrafficLight class
Criteria | Meet Specification |
---|---|
The |
A |
The |
The class shall have the public methods Also, there should be a private method |
FP.2: Implement a cycleThroughPhases method
Criteria | Meet Specification |
---|---|
The |
Implement the function with an infinite loop that measures the time between two loop cycles and toggles the current phase of the traffic light between red and green. The cycle duration should be a random value between 4 and 6 seconds, and the while-loop should use |
The |
The private |
FP.3 Define class MessageQueue
Criteria | Meet Specification |
---|---|
A |
A |
The |
Also, the Also, there should be a |
FP.4 Implement the method send
Criteria | Meet Specification |
---|---|
The method |
The method In the class |
FP.5 Implement the methods receive
and waitForGreen
Criteria | Meet Specification |
---|---|
The method |
The method receive should use |
The method |
The method |
FP.6 Implement message exchange
Criteria | Meet Specification |
---|---|
The message exchange is correctly implemented |
In class Intersection, a private member The method The method |